package com.dxh.service;

import com.alibaba.fastjson.JSON;

import java.io.IOException;

/**
 * @Author: Dengxh
 * @Date: 2021/1/17 21:13
 * @Description:
 */
public class JSONSerializer implements Serializer{

    public byte[] serialize(Object object) {
        return JSON.toJSONBytes(object);
    }

    public <T> T deserialize(Class<T> clazz, byte[] bytes) {
        return JSON.parseObject(bytes, clazz);
    }
}
